<template>
	<el-card class="form-container">
		<el-form :model="editForm" ref="editForm" :rules="dataRule" @keyup.enter.native="dataFormSubmitHandle()" label-width="90px">
			<el-form-item label="spu名称" prop="spuName">
				<el-input v-model="editForm.spuName" placeholder="请输入spu名称"></el-input>
			</el-form-item>
			<el-form-item label="spu副标题" prop="spuCaption">
				<el-input v-model="editForm.spuCaption" placeholder="请输入spu副标题"></el-input>
			</el-form-item>
			<el-form-item label="品牌编号" prop="brandCode">
				<el-input v-model="editForm.brandCode" placeholder="请输入品牌编号"></el-input>
			</el-form-item>
			<el-form-item label="一级商品分类编号" prop="categoryCode">
				<el-input v-model="editForm.categoryCode" placeholder="请输入一级商品分类编号"></el-input>
			</el-form-item>
			<el-form-item label="模版编号" prop="templateCode">
				<el-input v-model="editForm.templateCode" placeholder="请输入模版编号"></el-input>
			</el-form-item>
			<el-form-item label="运费模版编号" prop="freightCode">
				<el-input v-model="editForm.freightCode" placeholder="请输入运费模版编号"></el-input>
			</el-form-item>
			<el-form-item label="主图" prop="masterImage">
				<el-input v-model="editForm.masterImage" placeholder="请输入主图"></el-input>
			</el-form-item>
			<el-form-item label="图片列表:轮播图" prop="rotateImageList">
				<el-input v-model="editForm.rotateImageList" placeholder="请输入图片列表:轮播图"></el-input>
			</el-form-item>
			<el-form-item label="商品描述,详情" prop="goodsDesc">
				<el-input v-model="editForm.goodsDesc" placeholder="请输入商品描述,详情"></el-input>
			</el-form-item>
			<el-form-item label="规格列表" prop="specItems">
				<el-input v-model="editForm.specItems" placeholder="请输入规格列表"></el-input>
			</el-form-item>
			<el-form-item label="参数列表" prop="paraItems">
				<el-input v-model="editForm.paraItems" placeholder="请输入参数列表"></el-input>
			</el-form-item>
			<el-form-item label="销量" prop="salesVolume">
				<el-input v-model="editForm.salesVolume" placeholder="请输入销量"></el-input>
			</el-form-item>
			<el-form-item label="评论量" prop="commentVolume">
				<el-input v-model="editForm.commentVolume" placeholder="请输入评论量"></el-input>
			</el-form-item>
			<el-form-item label="上架状态 1.上架 2.未上架" prop="isMarketable">
				<el-input v-model="editForm.isMarketable" placeholder="请输入上架状态 1.上架 2.未上架"></el-input>
			</el-form-item>
			<el-form-item label="货号" prop="goodsItemCode">
				<el-input v-model="editForm.goodsItemCode" placeholder="请输入货号"></el-input>
			</el-form-item>
			<el-form-item label="是否启用规格 1.启用 2.禁用" prop="isEnableSpec">
				<el-input v-model="editForm.isEnableSpec" placeholder="请输入是否启用规格 1.启用 2.禁用"></el-input>
			</el-form-item>
			<el-form-item label="是否删除 1.是 2.否" prop="isDelete">
				<el-input v-model="editForm.isDelete" placeholder="请输入是否删除 1.是 2.否"></el-input>
			</el-form-item>
			<el-form-item label="是否需要用户提供度数:仅当散光镜,近视镜,远视镜的时需要提供" prop="userProvidedDegrees">
				<el-input v-model="editForm.userProvidedDegrees" placeholder="请输入是否需要用户提供度数:仅当散光镜,近视镜,远视镜的时需要提供"></el-input>
			</el-form-item>
			<el-form-item label="spu编号" prop="spuCode">
				<el-input v-model="editForm.spuCode" placeholder="请输入spu编号"></el-input>
			</el-form-item>
			<el-form-item label="商品重量(克)" prop="goodsWeight">
				<el-input v-model="editForm.goodsWeight" placeholder="请输入商品重量(克)"></el-input>
			</el-form-item>
			<el-form-item label="" prop="goodsPrice">
				<el-input v-model="editForm.goodsPrice" placeholder="请输入"></el-input>
			</el-form-item>
			<el-form-item label="" prop="goodsUnit">
				<el-input v-model="editForm.goodsUnit" placeholder="请输入"></el-input>
			</el-form-item>
			<el-form-item label="商品详情 类别  1.图片格式 2.富文本格式" prop="spuInfoType">
				<el-input v-model="editForm.spuInfoType" placeholder="请输入商品详情 类别  1.图片格式 2.富文本格式"></el-input>
			</el-form-item>
			<el-form-item>
				<el-button @click="cancel">取消</el-button>
				<el-button type="primary" @click="submit('dataForm')">确定</el-button>
			</el-form-item>
		</el-form>
	</el-card>
</template>

<script>
	import { findGoodsSpuDetail } from '@/api/mall/goodsSpu'
	export default {
		name: 'user-goodsSpu',
		data() {
			return {
				editForm: {
					id:'',
					spuName: '',
					spuCaption: '',
					brandCode: '',
					categoryCode: '',
					templateCode: '',
					freightCode: '',
					masterImage: '',
					rotateImageList: '',
					goodsDesc: '',
					specItems: '',
					paraItems: '',
					salesVolume: '',
					commentVolume: '',
					isMarketable: '',
					goodsItemCode: '',
					isEnableSpec: '',
					isDelete: '',
					userProvidedDegrees: '',
					spuCode: '',
					goodsWeight: '',
					goodsPrice: '',
					goodsUnit: '',
					spuInfoType: '',
				}
			}
		},
		created() {
			this.editForm.id = this.$route.query.id
			this.view(this.$route.query.id)
		},
		methods: {
			view(val) {
				findGoodsSpuDetail(val).then(res => {
					this.editForm = res.data.responseData
				})
			},
			cancel() {
				this.$router.go(-1)
			},
			update() {

			}
		}
	}
</script>

<style>
</style>
